<template>
  <div>
      <p>你要购买的商品数量:{{ count }}</p>
      <button v-on:click='count = count + 1'>增加1</button>
      <button v-on:click='addFn'>增加1</button>
      <button @click="addCountFn(5)">一次加5个</button>
  </div>
</template>

<script>
export default {
    methods:{
        addFn(){
            this.count++
        },
        addCountFn(num){
            this.count += num
        }
    },
    data(){
        return{
            count:0
        }
    }
}
</script>

<style>

</style>